package com.test.xshang.pattern.proxy.impl;

import com.test.xshang.pattern.proxy.ToBPayment;

/**
 * @BelongsProject: simpleframework
 * @BelongsPackage: com.test.xshang.pattern.proxy.impl
 * @Author: xshang
 * @CreateTime: 2023-06-26  21:14
 * @Description: 支付宝作为代理类 帮用户取钱 并付款
 * @Version: 1.0
 */
public class AlipayToB implements ToBPayment {
    ToBPayment toBPayment;

    public AlipayToB(ToBPayment toBPayment) {
        this.toBPayment = toBPayment;
    }
    @Override
    public void pay() {
        beforePay();
        toBPayment.pay();
        afterPay();
    }

    private void beforePay() {
        System.out.println("从银行取钱...");
    }
    private void afterPay() {
        System.out.println("支付成功...");
    }
}
